package com.alibaba.cloud.fooweb;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p> Demo </p>
 *
 * @author Chris
 * @since 2022/11/14 17:12
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    private final DemoService demoService;

    public DemoController(DemoService demoService) {
        this.demoService = demoService;
    }

    @GetMapping("/hello")
    public String hello(String name) {
        return demoService.hello(name);
    }

    @GetMapping("/time")
    public Date getCurrentTime(Integer slow) {
        return demoService.getCurrentTime(slow);
    }

    @GetMapping("/bonjour/{name}")
    public String bonjour(@PathVariable("name") String name) {
        return demoService.bonjour(name);
    }

}